package edu.cque.sp04.feign;

import edu.cque.sp01.entity.Item;
import edu.cque.sp01.web.util.JsonResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

/**
 * @author Hua
 * @create 2022-08-18 15:55
 */
@FeignClient(value = "item-service", contextId = "itemClient")
public interface ItemClient {
    @GetMapping("/{orderId}")
    JsonResult<List<Item>> getItems(@PathVariable("orderId") String orderId);

    @PostMapping("/decreaseNumber")//从协议体里面获取数据,用requestBody解析参数
    JsonResult<?> decreaseNumber(@RequestBody List<Item> items);
}
